package com.ssy.jt808.gateway.sdk.terminal.constant;

/**
 * Jt808网关消息枚举
 *
 * @author wangzezhou
 */
public enum LocationMessageEnum{

  /** 终端定位 */
  Realtime("Realtime"),

  /** 终端补偿定位 */
  Backoff("Backoff");

  LocationMessageEnum( String code ){
    this.code = code;
  }

  /** 枚举编码 */
  private final String code;

  /**
   * 获取枚举编码值
   *
   * @return 枚举编码值
   */
  public String code(){
    return code;
  }

  /**
   * 根据 枚举编码 获取枚举对象
   *
   * @param code 枚举编码
   *
   * @return 枚举对象
   */
  public LocationMessageEnum of( String code ){

    for(LocationMessageEnum e : LocationMessageEnum.values()){
      if( e.code.equalsIgnoreCase(code) ){
        return e;
      }
    }

    return null;
  }
}
